package day1125;
//int[]   a1={数据1， 数据2};   //方式一
//int[]   a1=new int[]{数据1， 数据2}; //方式一
public class Demo5 {
    public static void main(String[] args) {
        int[]  a1={19,  18,  20, 21, 19,17};
        int[]  a2=new int[]{19,18, 20,21};

        System.out.println( a1[1] );
        int  x=a2[3];
        a2[2]=40;//将a2代表的数组的第2位存入40




        char[]  a3={'l','w'};
        char[]  a4=new char[] {'A', '\t'};

        System.out.println( a3[1] );
        System.out.println( a4[0] );




        String[] ar=new String[]{"张三", "张三","李四"};
        System.out.println(ar.length);
        System.out.println( ar[  ar.length -1] );




        boolean[]  bs={true, false, false};
        System.out.println( bs.length );
        //打印： bs代表的数组的长度



        boolean[]  bs2=new boolean[]{true,true};
        System.out.println(bs2.length);//2
        System.out.println( bs2[bs2.length-1] );




        float[]  fs={ 3.5F, 3.14f };
        double[]  fs2=new double[]{1.1F, 3.5D};
        System.out.println(fs.length);

        double  r= fs2 [fs2.length-1];







        int[]  as={1, 10, 5, 3, 7};
        //循环打印数组每个元素
        for(int i=0; i< as.length ;i++) {
            System.out.println(as[i]);
        }

        char[]  chs={'A', 'C', 'B', 'E','F'};
        for(int n=0; n<5 ;n++){
            System.out.println(chs[n]);
        }

        String[]  ss={"甘草", "奶瓶", "剪刀"};
        for(int n=0; n<3 ;n++){
            System.out.println(ss[n]);
        }


        short[]  st1={5, 600, 900,4};
        //将数组中每个+10 ，再放到数组中(从后往前操作)
        for(int i=3; i>=0 ; i--){
            st1[i] =  (short)(st1[i] + 10);
        }

    }
}